const webpack = require('webpack')
const { merge } = require('webpack-merge')
const common = require('./webpack.common')
const path = require('path')

const HtmlWebpackPlugin = require('html-webpack-plugin')

module.exports = merge(common, {
  mode: 'development',
  devtool: 'cheap-eval-module-source-map',
  devServer: {
    hot: true,
    contentBase: 'public'
  },
  plugins: [
    new webpack.HotModuleReplacementPlugin(),
    new HtmlWebpackPlugin({
      filename: 'index.html',
      template: 'public/index.html',
      inject: true,
      title: 'webpack task',
      favicon: path.resolve('public/favicon.ico')
    })
  ]
})
